]> git.r.bdr.sh - rbdr/super-polarity/blobdiff - Super Polarity/ParticleEngine.cs
I think bullets come out now.
[rbdr/super-polarity] / Super Polarity / ParticleEngine.cs
index 0fced25f179873533b230e709d03e6e11c4c748a..51188ae3815e1c90c66f34777c31c90063d90d2c 100644 (file)
@@ -11,7 +11,12 @@ namespace SuperPolarity
     {
         private Random random;
         public Vector2 EmitterLocation { get; set; }
-        public Color Color;
+        public Color Color; //TODO: Color list for random colors.
+        public int TTL;
+        public int TTLRandomFactor;
+        public int ScatterFactor;
+        public int ParticleCount;
+        public float StretchFactor;
         private List<Particle> particles;
         private List<Texture2D> textures;
 
@@ -22,6 +27,9 @@ namespace SuperPolarity
             this.particles = new List<Particle>();
             random = new Random();
             Color = Color.Red;
+            TTL = 20;
+            TTLRandomFactor = 40;
+            StretchFactor = 1;
         }
 
         private Particle GenerateNewParticle()
@@ -31,12 +39,16 @@ namespace SuperPolarity
             Vector2 velocity = new Vector2(
                 1f * (float)(random.NextDouble() * 2 - 1),
                 1f * (float)(random.NextDouble() * 2 - 1));
+
             float angle = 0;
             float angularVelocity = 0.1f * (float)(random.NextDouble() * 2 - 1);
             Color color = Color;
-            float size = (float)random.NextDouble();
+            float size = (float)random.NextDouble() * StretchFactor;
+
+            position.X += random.Next(-ScatterFactor, ScatterFactor);
+            position.Y += random.Next(-ScatterFactor, ScatterFactor);
 
-            int ttl = 20 + random.Next(40);
+            int ttl = TTL + random.Next(TTLRandomFactor);
 
             return new Particle(texture, position, velocity, angle, angularVelocity, color, size, ttl);
         }